Conversation
rlundeen2
left a comment
There was a problem hiding this comment.
This looks good, but we're deprecating all of this very soon, it probably should already be deprecated. The new frontend is in /frontend.
I don't see a downside to merging this sooner vs later though
There was a problem hiding this comment.
Pull request overview
This PR updates the deprecated pyrit.ui startup path so that non-Windows platforms (Linux/macOS) no longer error out during the “is UI already running?” probe or the __main__ startup guard, while preserving the existing Windows single-instance mutex behavior.
Changes:
- Introduces a reusable module-scope
create_mutex()helper and uses it in__main__. - Makes
create_mutex()a no-op returningTrueon non-Windows platforms. - Makes
is_app_running()returnFalseon non-Windows platforms instead of raising, and adds unit tests for these behaviors.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
pyrit/ui/app.py |
Moves mutex creation to module scope and makes both mutex creation and “already running” checks non-fatal on non-Windows. |
tests/unit/ui/test_app.py |
Adds unit tests asserting non-Windows behavior for is_app_running() and create_mutex(). |
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Needs to fix the indent |
romanlutz
left a comment
There was a problem hiding this comment.
@rlundeen2 I do see a downside to merging this. It's all manual validation. It's deprecated and will go away in about a month so let's try not to make functional changes perhaps?
Summary
This fixes the deprecated Gradio UI startup path on non-Windows platforms.
Problem
pyrit.ui.appcurrently treats the Windows mutex logic as mandatory in two places:is_app_running()raisesNotImplementedErroron non-Windows platforms__main__startup path defines a nestedcreate_mutex()helper that also raisesNotImplementedErroron non-Windows platformsThat creates two failure modes on Linux/macOS:
AppRPCServer.start()callsis_app_running()before launching the UI, so the RPC path fails during the probe step.__main__block before it can start the Gradio app.Fix
create_mutex()to module scope so the startup guard is reusable and testablecreate_mutex()a no-op that returnsTrueon non-Windows platformsis_app_running()returnFalseon non-Windows platforms instead of raisingThis preserves the existing Windows mutex-based single-instance behavior while allowing non-Windows platforms to proceed through the UI startup path.
Tests
Added unit coverage for the non-Windows behavior:
is_app_running()returnsFalsecreate_mutex()returnsTrueValidation command:
Validation result:
The warning is the existing deprecation warning for
pyrit.ui.